package main

import (
	"fmt"
	"runtime"
)

func add(x, y int) int {
	var c int
	defer fmt.Printf("1 return %d\n", c)
	defer func() { fmt.Printf("2 return %d\n", c) }()
	fmt.Printf("add called: x=%d, y=%d\n", x, y)
	c = x + y
	return c
}

func main() {
	fmt.Println("main start")
	// add(4, 5)
	go add(4, 5)
	fmt.Println(runtime.NumGoroutine())
	// time.Sleep(2 * time.Second)
	fmt.Println("main end")
	fmt.Println(runtime.NumGoroutine())
}
